import { createApp } from 'vue';
import App from './App.vue';
import ViewUIPlus from 'view-ui-plus';
import 'view-ui-plus/dist/styles/viewuiplus.css';

const APP_EL_ID = 'ozon-crawl-app';
if (location.href.includes('https://www.ozon.ru')) {
  window.addEventListener('load', () => {
    const ndStyle = document.createElement('link');
    ndStyle.rel = 'stylesheet';
    ndStyle.href = 'https://unpkg.com/view-ui-plus/dist/styles/viewuiplus.css';
    ndStyle.addEventListener('load', () => {
      const ndApp = document.createElement('div');
      ndApp.id = APP_EL_ID;
      document.body.prepend(ndApp);
      const app = createApp(App);
      app.use(ViewUIPlus).mount(`#${APP_EL_ID}`);
      document.body.style.paddingTop = '60px';
    });
    document.head.appendChild(ndStyle);
  });
}
